package com.example.s3demo.config

import com.example.s3demo.interceptor.S3Interceptor
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer

@Configuration
class WebConfig(
    private val s3Interceptor: S3Interceptor
) : WebMvcConfigurer {
    override fun configurePathMatch(configurer: PathMatchConfigurer) {
        configurer.setUseTrailingSlashMatch(true)
    }

    override fun addInterceptors(registry: InterceptorRegistry) {
        registry.addInterceptor(s3Interceptor).addPathPatterns("/s3/**");
    }
}